// ================================================================================
// 		File: PartyQuestionnaireRecordDetail.cs
// 		Desc: 
//  
// 		Called by:   
//               
// 		Auth: chenwenzhi（）
// 		Date: 2016-06-27 21:47
// ================================================================================
// 		Change History
// ================================================================================
// 		Date:		Author:				Description:
// 		--------	--------			-------------------
//    
// ================================================================================
// 
// ================================================================================
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq; 
using System.Text;
using MySql.Data.MySqlClient;
using ZHDJ.Core;

namespace ZHDJ.Data.Models.Questionnaire
{
    /// <summary>
    /// 用户提交详细
    /// </summary>   
    public class PartyQuestionnaireRecordDetail 
    { 
		#region 属性
        /// <summary>
        /// ID
        /// </summary>
        public string ID { get; set; }
		
        /// <summary>
        /// 题目ID
        /// </summary>
        public string SubjectID { get; set; }
		
        /// <summary>
        /// 选择ID
        /// </summary>
        public string OptionID { get; set; }

        /// <summary>
        /// 填空内容
        /// </summary>
        public string Tk { get; set; }

        /// <summary>
        /// 记录ID
        /// </summary>
        public string RecordID { get; set; }
		
		#endregion 

		#region 查询管理

		 public static DataSet GetGridData(int pageIndex, int pageSize, string searchKey = "")
        {
            List<MySqlParameter> parameters = new List<MySqlParameter>()
            {
                new MySqlParameter(){DbType = DbType.Int32,ParameterName = "Begin",Value = (pageIndex)*pageSize},
                new MySqlParameter(){DbType = DbType.Int32,ParameterName = "PageSize",Value = pageSize}
            };


            StringBuilder sb = new StringBuilder();
            sb.Append(@"select SQL_CALC_FOUND_ROWS  data.ID,data.SubjectID,data.OptionID,data.RecordID
                        from tblPartyQuestionnaireRecordDetail data
                        where 1=1 ");
            //if (!string.IsNullOrEmpty(searchKey)) 
            //{
            //    sb.Append(" and a.Name like ?key ");
            //    parameters.Add(
            //        new MySqlParameter(){DbType = DbType.String,ParameterName = "key",Value = string.Format("%{0}%", searchKey)});
            //}
           
            sb.Append(" order by data.CreateTime desc LIMIT ?Begin ,?PageSize;SELECT FOUND_ROWS();");
            return MySqlHelper.ExecuteDataSet(sb.ToString(), parameters.ToArray());
        }
		#endregion
    }
}
